<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Users extends Model
{

    //
     protected $table = 'users';       //指定绑定的表为user,否则默认绑定users表
     public function checkUsers( $request){
     	//dd($request);
     	$username = $request->input('username');
        $password = $request->input('password');
        $password = md5($password);
        // dd($password);
     	//echo $username;
     	//$name = $request->input('username');
     	//echo $name;
     	$ob = $this->where('username',$username)->first();
    	// 如果通过这个用户名能查出数据
    	if($ob){
    		//则判断用户输入的密码和通过用户名查到的数据中的密码是否匹配
    		if($password == $ob->password){
    			return $ob;
    		}
    	}else{
    		return null;
    	}
     		
     }
   


}
